home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-SPAR.{_A / KDEBUG.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  2KB  |  78 lines

  1. /* $Id: kdebug.h,v 1.3 1997/12/14 23:24:47 ecd Exp $
  2.  * kdebug.h:  Defines and definitions for debugging the Linux kernel
  3.  *            under various kernel debuggers.
  4.  *
  5.  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  6.  */
  7. #ifndef _SPARC64_KDEBUG_H
  8. #define _SPARC64_KDEBUG_H
  9.  
  10. #include <asm/openprom.h>
  11.  
  12. /* XXX This needs to all be fixed for Ultra/V9 -DaveM */
  13.  
  14. /* The debugger lives in 1MB of virtual address space right underneath
  15.  * the boot prom.
  16.  */
  17.  
  18. #define DEBUG_FIRSTVADDR       0xffc00000
  19. #define DEBUG_LASTVADDR        LINUX_OPPROM_BEGVM
  20.  
  21. /* Breakpoints are enter through trap table entry 126.  So in sparc assembly
  22.  * if you want to drop into the debugger you do:
  23.  *
  24.  * t DEBUG_BP_TRAP
  25.  */
  26.  
  27. #define DEBUG_BP_TRAP     126
  28.  
  29. #ifndef __ASSEMBLY__
  30. /* The debug vector is passed in %o1 at boot time.  It is a pointer to
  31.  * a structure in the debuggers address space.  Here is its format.
  32.  */
  33.  
  34. typedef unsigned int (*debugger_funct)(void);
  35.  
  36. struct kernel_debug {
  37.     /* First the entry point into the debugger.  You jump here
  38.      * to give control over to the debugger.
  39.      */
  40.     unsigned long kdebug_entry;
  41.     unsigned long kdebug_trapme;   /* Figure out later... */
  42.     /* The following is the number of pages that the debugger has
  43.      * taken from to total pool.
  44.      */
  45.     unsigned long *kdebug_stolen_pages;
  46.     /* Ok, after you remap yourself and/or change the trap table
  47.      * from what you were left with at boot time you have to call
  48.      * this synchronization function so the debugger can check out
  49.      * what you have done.
  50.      */
  51.     debugger_funct teach_debugger;
  52. }; /* I think that is it... */
  53.  
  54. extern struct kernel_debug *linux_dbvec;
  55.  
  56. /* Use this macro in C-code to enter the debugger. */
  57. extern __inline__ void sp_enter_debugger(void)
  58. {
  59.     __asm__ __volatile__("jmpl %0, %%o7\n\t"
  60.                  "nop\n\t" : :
  61.                  "r" (linux_dbvec) : "o7", "memory");
  62. }
  63.  
  64. #define SP_ENTER_DEBUGGER do { \
  65.          if((linux_dbvec!=0) && ((*(short *)linux_dbvec)!=-1)) \
  66.            sp_enter_debugger(); \
  67.                } while(0)
  68.  
  69. #endif /* !(__ASSEMBLY__) */
  70.  
  71. /* Some nice offset defines for assembler code. */
  72. #define KDEBUG_ENTRY_OFF    0x0
  73. #define KDEBUG_DUNNO_OFF    0x4
  74. #define KDEBUG_DUNNO2_OFF   0x8
  75. #define KDEBUG_TEACH_OFF    0xc
  76.  
  77. #endif /* !(_SPARC64_KDEBUG_H) */
  78.